#include <REGX52.H>
#include <intrins.h>
unsigned char snum[]={~0x3f,~0x06,~0x5b,~0x4f,~0x66,~0x6d,~0x7d,~0x07,~0x7f, ~0x6f,~0x77,~0x7c,~0x39,~0x5e,~0x79,~0x71,~0x00};
void Delay1ms(unsigned int xms)	//@11.0592MHz
{
	unsigned char i, j;
		while(xms--){
	_nop_();
	i = 2;
	j = 199;
	do
	{
		while (--j);
	} while (--i);
}
}
void shumaled(unsigned int num, unsigned int n){
	switch (num){
		case 1:P0=0x01;break;
		case 2:P0=0x02;break;
		case 3:P0=0x04;break;
		case 4:P0=0x08;break;
		case 5:P0=0x10;break;
		case 6:P0=0x20;break;
		case 7:P0=0x40;break;
		case 8:P0=0x80;break;
	}
		P2=P2&0x1f|0xc0;
		P2=P2&0x1f;
		P0=snum[n];
		P2=P2&0x1f|0xe0;
		Delay1ms(1);
		P0=0xff;
		P2=P2&0x1f;
}